/**
 * https://leetcode.cn/submissions/detail/565031782/
 * 70. 爬楼梯
 * easy, 黄伟杰 2024.9.7
 * 线性DP
 */

#include <bits/stdc++.h>
using namespace std;

class Solution
{
public:
    int climbStairs(int n)
    {
        int a = 1, b = 1, sum = 0;
        for (int i = 0; i < n - 1; i++)
        {
            sum = a + b;
            a = b;
            b = sum;
        }
        return b;
    }
};
